package com.firexxx.study.performancetest.scene;

import com.firexxx.study.util.chart.ChartUtil;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 多个维度一起比较观察
 *
 * @author fireXXX
 * @date 2020/11/19 0:32
 **/
@Data
public class GridResult implements IResult {

    private String name = "default";

    private List<SingleResult> data = new ArrayList<>();

    public void calMax() {
        if (!CollectionUtils.isEmpty(data)) {
            data.stream().forEach(SingleResult::calMax);
        }
    }

    public void calScalaMax(long rate) {
        data.forEach(item -> item.calScalaMax(rate));
    }

    @Override
    public Long getMax() {
        return null;
    }

    @Override
    public void show(String title) {
        calMax();
        ChartUtil.show(title, this);
    }

}